package com.ikun.hosuserservice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ikun.common.entity.Convention;
import org.apache.ibatis.annotations.*;

@Mapper
public interface IUserMapper extends BaseMapper<Convention> {


    /**
     * 根据订单号订单
     *
     * @return
     */
    @Select("select * from convention where trade_no = #{tradeNo}")
    Convention selectOrderByTradeNo(@Param("tradeNo") String tradeNo);


    /**
     * 根据订单号修改订单状态
     *
     * @param tradeNo
     * @param status
     */
    @Update("update convention set state = #{status} where trade_no = #{tradeNo}")
    void updateOrderStatus(@Param("tradeNo") String tradeNo, @Param("status") Integer status);


    /**
     * 插入订单
     * @param convention
     */
    @Insert("insert into convention (id, user_id, department_id, doc_id, pat_id, type_id, money, date, time_id, state, create_time, update_time, del, trade_no,pay_type) " +
            "values (#{id}, #{userId}, #{departmentId}, #{docId}, #{patId}, #{typeId}, #{money}, #{date}, #{timeId}, #{state}, #{createTime}, #{updateTime}, #{del}, #{tradeNo},#{payType})")
    void insertOrder(Convention convention);

}
